﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace POS
{
    /// <summary>
    /// Interaction logic for Salads.xaml
    /// </summary>
    public partial class Salads : Window
    {
        double caeserSaladPrice = 5.50;
        double capreseSaladPrice = 6.20;
        double greekSaladPrice = 3.30;
        double greenSaladPrice = 7.40;
        double springSaladPrice = 6.80;
        double watercressSaladPrice = 4.50;

        public Salads()
        {
            InitializeComponent();
        }

        private void ButtonBackToMainMenu(object sender, RoutedEventArgs e)
        {
            MainWindow mainMenuWindow = new MainWindow();
            mainMenuWindow.Show();
            this.Close();
        }

        private void GoToOrdered(object sender, RoutedEventArgs e)
        {
            Ordered orderedMenu = new Ordered();
            orderedMenu.Show();
            this.Close();
        }


        private void ButtonSaladCaeser(object sender, RoutedEventArgs e)
        {
            // TODO: replace 0 with the text box number
            if ((this.TextBoxCaesarCount.Text != "0") && (this.TextBoxCaesarCount.Text != String.Empty)) 
            {
                for (int i = 0; i < int.Parse(this.TextBoxCaesarCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Salad Caeser", caeserSaladPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad)); 
                }          
            }
        }

        private void ButtonCaprese(object sender, RoutedEventArgs e)
        {

            if ((this.TextBoxCapreseCount.Text != "0") && (this.TextBoxCapreseCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxCapreseCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Salad Caprese", capreseSaladPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonGreek(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxGreekCount.Text != "0") && (this.TextBoxGreekCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxGreekCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Salad Greek", greekSaladPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonGreen(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxGreenCount.Text != "0") && (this.TextBoxGreenCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxGreenCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Salad Green", greenSaladPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }
        }

        private void ButtonSpring(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxSpringCount.Text != "0") && (this.TextBoxSpringCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxSpringCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Salad Spring", springSaladPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }

        }

        private void ButtonWatercress(object sender, RoutedEventArgs e)
        {
            if ((this.TextBoxWatercressCount.Text != "0") && (this.TextBoxWatercressCount.Text != String.Empty))
            {
                for (int i = 0; i < int.Parse(this.TextBoxWatercressCount.Text); i++)
                {
                    Table.orderList.Add(new Food("Salad Watercress", watercressSaladPrice, 5, FoodOptions.Size.g250, FoodOptions.Type.Salad));
                }
            }

        }

        private void AddCountCeasarButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxCaesarCount.Text == String.Empty)
            {
                this.TextBoxCaesarCount.Text = "0";
            }

            this.TextBoxCaesarCount.Text = (int.Parse(this.TextBoxCaesarCount.Text) + 1).ToString();
        }

        private void RemoveCountCeasarButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxCaesarCount.Text == String.Empty)
            {
                this.TextBoxCaesarCount.Text = "0";
            }

            if (int.Parse(this.TextBoxCaesarCount.Text) > 0)
            {
                this.TextBoxCaesarCount.Text = (int.Parse(this.TextBoxCaesarCount.Text) - 1).ToString();
            }
            
        }

        private void RemoveCountCapreseButton_Click(object sender, RoutedEventArgs e)
        {

            if (this.TextBoxCapreseCount.Text == String.Empty)
            {
                this.TextBoxCapreseCount.Text = "0";
            }

            if (int.Parse(this.TextBoxCapreseCount.Text) > 0)
            {
                this.TextBoxCapreseCount.Text = (int.Parse(this.TextBoxCapreseCount.Text) - 1).ToString();
            }
        }

        private void AddCountCapreseButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxCapreseCount.Text == String.Empty)
            {
                this.TextBoxCapreseCount.Text = "0";
            }

            this.TextBoxCapreseCount.Text = (int.Parse(this.TextBoxCapreseCount.Text) + 1).ToString();
        }

        private void RemoveCountGreekButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxGreekCount.Text == String.Empty)
            {
                this.TextBoxGreekCount.Text = "0";
            }

            if (int.Parse(this.TextBoxGreekCount.Text) > 0)
            {
                this.TextBoxGreekCount.Text = (int.Parse(this.TextBoxGreekCount.Text) - 1).ToString();
            }
        }

        private void AddCountGreekButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxGreekCount.Text == String.Empty)
            {
                this.TextBoxGreekCount.Text = "0";
            }
            this.TextBoxGreekCount.Text = (int.Parse(this.TextBoxGreekCount.Text) + 1).ToString();
        }

        private void RemoveCountGreenButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxGreenCount.Text == String.Empty)
            {
                this.TextBoxGreenCount.Text = "0";
            }

            if (int.Parse(this.TextBoxGreenCount.Text) > 0)
            {
                this.TextBoxGreenCount.Text = (int.Parse(this.TextBoxGreenCount.Text) - 1).ToString();
            }
        }

        private void AddCountGreenButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxGreenCount.Text == String.Empty)
            {
                this.TextBoxGreenCount.Text = "0";
            }
            this.TextBoxGreenCount.Text = (int.Parse(this.TextBoxGreenCount.Text) + 1).ToString();
        }

        private void RemoveCountSpringButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxSpringCount.Text == String.Empty)
            {
                this.TextBoxSpringCount.Text = "0";
            }

            if (int.Parse(this.TextBoxSpringCount.Text) > 0)
            {
                this.TextBoxSpringCount.Text = (int.Parse(this.TextBoxSpringCount.Text) - 1).ToString();
            }
        }

        private void AddCountSpringButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxSpringCount.Text == String.Empty)
            {
                this.TextBoxSpringCount.Text = "0";
            }
            this.TextBoxSpringCount.Text = (int.Parse(this.TextBoxSpringCount.Text) + 1).ToString();
        }

        private void RemoveCountWatercressButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxWatercressCount.Text == String.Empty)
            {
                this.TextBoxWatercressCount.Text = "0";
            }

            if (int.Parse(this.TextBoxWatercressCount.Text) > 0)
            {
                this.TextBoxWatercressCount.Text = (int.Parse(this.TextBoxWatercressCount.Text) - 1).ToString();
            }
        }

        private void AddCountWatercressButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.TextBoxWatercressCount.Text == String.Empty)
            {
                this.TextBoxWatercressCount.Text = "0";
            }
            this.TextBoxWatercressCount.Text = (int.Parse(this.TextBoxWatercressCount.Text) + 1).ToString();
        }
    }
}
